<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('nickname', 16)->nullable(); //昵称
            $table->string('signature',255)->nullable();; //个性签名
            $table->json('avatar')->nullable(); //头像
            $table->string('username',18); //用户名
            $table->string('mobile',15)->nullable();;//手机号
            $table->string('email',60)->nullable();//E-mail
            $table->string('qq',15)->nullable();//QQ号
            $table->string('level',8)->nullable();//用户等级
            $table->string('weixin',30)->nullable();//微信号
            $table->string('wangwang',30)->nullable();//阿里旺旺
            $table->string('qq_token',64)->nullable();//QQ登录TOKEN
            $table->string('weixin_token',64)->nullable();//微信登录TOKEN
            $table->string('weibo_token',64)->nullable();//微博登录TOKEN
            $table->string('password',64);//密码
            $table->ipAddress('last_visited_ip')->nullable();//客户最后登录IP
            $table->decimal('asset', 15, 6)->default(0);//资产
            $table->decimal('frozen_asset', 15, 6)->default(0);//冻结资产
            $table->decimal('expense_asset', 15, 6)->default(0);//消费资产
            $table->integer('integer')->default(0);//积分
            $table->integer('point_bao')->default(0);//积分宝
            $table->json('other_points')->nullable(); //自定义积分
            $table->string('client',64)->nullable();//客户端
            $table->string('source',16)->nullable();//来源
            $table->string('app_identify',64)->nullable();//客户端唯一标识
            $table->string('app_uuid',64)->nullable();//客户端唯一标识
            $table->integer('referrer')->nullable();//推荐人ID
            $table->string('harebin_key',16)->nullable();//掌柜码
            $table->boolean('robot')->default(false);//是否系统虚拟用户
            $table->boolean('available')->default(true);//是否启用账号

            $table->rememberToken();
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
